#include "apue.h"
#define BUFSIZE 1024 * 1024 * 1024

static char buf[BUFSIZE];

void sig_alrm(int) {
    fprintf(stderr, "execute alarm handler.\n");
}

int main(int argc, char ** argv) {
    int n;
    if (signal_intr(SIGALRM, sig_alrm) == SIG_ERR)
        err_sys("signal(SIGALRM) error");

    printf("kakaxi\n");
    alarm(1);
    if ((n= fwrite(buf, sizeof(buf), 1, stdout)) < 1) {
        err_sys("fwrite error");
    }
    fprintf(stderr, "n= %d\n", n);
    fprintf(stderr, "end\n");
    return(0);
}
